import { request } from "./request";
// 創建訂單
export function createOrder(params){
    return request({
        url:'/api/orders',
        method:'post',
        params
    })
}
// 獲取訂單預覽
export function getOrderPreview(){
   return  request({
    url:'/api/orders/preview'
   })
}
// 訂單支付，模擬支付
export function paytest(order,params){
    return request({
        url:`/api/orders/${order}/paytest`,
        method:'patch',
        params
    })
}
// 訂單狀態
export function payOrderStatus(order){
    return request({
        url:`/api/orders/${order}/status`,
    })
}
// 獲取訂單列表{page1,status:2,include:'user,orderDetails'}
export function getOrderList(params){
    return request({
        url:'/api/orders',
       
        params
    })
}
// 訂單詳情
export function getOrderDetail(order){
   return request({
    url:`/api/orders/${order}`,
    params:{
        include:'user,orderDetails.goods'
    }
   })
}
// 確認訂單
export function confirmOrder(order){
    return request({
        url:`/api/orders/${order}/confirm`,
        method:'patch'
    })
}
// 獲取物流信息
export function ViewExpress(order){
    return request({
        url:`/api/orders/${order}/express`
        
    })
}
//order:訂單 preview:預覽 test:測試 patch:補丁 include:包括 confirm:確認 View:視圖 Express:表達